package com.ss.android.account;

import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import android.os.Looper;
import android.os.Message;
import android.os.Process;
import android.webkit.CookieSyncManager;

import com.bytedance.common.utility.Logger;
import com.bytedance.common.utility.c.SharedPreferenceCompat;
import com.bytedance.common.utility.collection.WeakHandler;
import com.bytedance.common.utility.collection.WeakHandler.Callback;
import com.bytedance.common.utility.collection.WeakList;
import com.bytedance.frameworks.b.a.ComponentsManifest;
import com.bytedance.frameworks.baselib.network.dispatcher.IRequest.Priority;
import com.ss.android.account.b.OnAccountRefreshListener;
import com.ss.android.account.b.k;
import com.ss.android.account.bus.event.g;
import com.ss.android.account.model.SharePlatform;
import com.ss.android.common.applog.AppLog;
import com.ss.android.common.dialog.AlertDialog;
import com.ss.android.common.lib.MobClickCombiner;
import com.ss.android.messagebus.SubscriptionRouter;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;

public final class Spipe implements Callback {
    public int A = 0;
    public int B = 0;
    public long C = 0;
    public long pgcMediaid = 0;
    public boolean isRecommendAllowed;
    public String recommendHintMessage;
    public long lastShowWeiboExpiredTime = 0;
    public String userBirthday;
    public String userLocation;
    public long mediaId = 0;
    public boolean verifyStatus = false;
    public final SharePlatform[] mSharePlatforms;
    public final SharePlatform[] M = new SharePlatform[]{SharePlatform.MOBILE, SharePlatform.QZONE, SharePlatform.WEIXIN};
    public boolean N = false;
    final Context O;
    public WeakHandler P = new WeakHandler(Looper.getMainLooper(), ((Callback) this));
    private static String loginV2Url;
    private static String loginContinueUrl;
    private static String dataV2AppShareUrl;
    private static final String[] T;
    private static final ConcurrentHashMap U;
    private static Spipe instance;
    private SharePlatform W = null;
    private String pgcAvatarUrl = "";
    private String pgcName = "";
    private String Z;
    public static final String ssoCallbackV2Url;
    private final SharePlatform[] aa = new SharePlatform[]{SharePlatform.QZONE, SharePlatform.WEIXIN};
    private final SharePlatform[] ab = new SharePlatform[0];
    private WeakList<OnAccountRefreshListener> onAccountRefreshListenerWeakList = new WeakList();
    private WeakList ad = new WeakList();
    public static final String userInfoUrl;
    static String userLogoutUrl;
    public static final String userUploadImageUrl;
    public static final String userFollowingUrl;
    public static final String userBlockCreateUrl;
    public static final String userBlockCancelUrl;
    public static final String relationFollowV2Url;
    public static final String relationUnfollowUrl;
    public static final String articleV1TabCommentsUrl;
    public static final String dataPostMessageUrl;
    public static final String dataItemActionUrl;
    public static final String userDataBatchActionUrl;
    public static final String dataBatchItemActionUrl;
    public static final String dataCommentActionUrl;
    public boolean isLogin = false;
    public String userName = "";
    public int userGender;
    public String screenName = "";
    public String userDescription = "";
    public int userScore = 0;
    public long userId = 0;
    public String sessionKey = "";
    public String avatarUrl;
    public boolean userVerified;
    public int z = 0;

    static {
        int v5 = 21;
        int v0 = 1;
        loginV2Url = withIsubHost("/2/auth/login/v2/");
        loginContinueUrl = withIsubHost("/2/auth/login_continue/");
        withIsubHost("/2/auth/logout/");
        withIsubHost("/2/auth/sso_switch_bind/");
        ssoCallbackV2Url = withIsubHost("/2/auth/sso_callback/v2/");
        userInfoUrl = withIsubHost("/2/user/info/");
        userLogoutUrl = withIsubHost("/2/user/logout/");
        withIsubHost("/2/user/update/v2/");
        withIbHost("/2/essay/zone/modify_gender/");
        withIsubHost("/2/user/profile/v2/");
        withIsubHost("/2/user/upload_photo/");
        userUploadImageUrl = withIsubHost("/2/user/upload_image/");
        userFollowingUrl = withIbHost("/user/following/");
        userBlockCreateUrl = withIbHost("/user/block/create/");
        userBlockCancelUrl = withIbHost("/user/block/cancel/");
        relationFollowV2Url = withIsubHost("/2/relation/follow/v2/");
        relationUnfollowUrl = withIsubHost("/2/relation/unfollow/");
        articleV1TabCommentsUrl = withIbHost("/article/v1/tab_comments/");
        dataPostMessageUrl = withIbHost("/2/data/post_message/");
        withIsubHost("/2/data/share_message/");
        dataItemActionUrl = withIsubHost("/2/data/item_action/");
        userDataBatchActionUrl = withIsubHost("/user_data/batch_action/");
        dataBatchItemActionUrl = withIsubHost("/2/data/batch_item_action/");
        dataCommentActionUrl = withIbHost("/2/data/comment_action/");
        dataV2AppShareUrl = withIsubHost("/2/data/v2/app_share/");
        String[] v1 = new String[v5];
        v1[0] = null;
        v1[1] = "digg";
        v1[2] = "bury";
        v1[3] = "download";
        v1[4] = "repin";
        v1[5] = "unrepin";
        v1[6] = "play";
        v1[7] = "share";
        v1[8] = "comment";
        v1[9] = "dislike";
        v1[10] = "undislike";
        v1[11] = "share_weixin";
        v1[12] = "share_wx_moments";
        v1[13] = "share_system";
        v1[14] = null;
        v1[15] = "share_qq";
        v1[16] = null;
        v1[17] = "share_qzone";
        v1[18] = "like";
        v1[19] = "unlike";
        v1[20] = "share_dingding";
        T = v1;
        U = new ConcurrentHashMap();
        while (v0 < v5) {
            if (!android.support.design.a.isTextEmpty(T[v0])) {
                U.put(T[v0], Integer.valueOf(v0));
            }
            ++v0;
        }
    }

    private Spipe(Context arg8) {
        this.O = arg8.getApplicationContext();
        this.mSharePlatforms = this.aa;
    }

    public final void a(Context context, SharePlatform platformItem) {
        platformItem.mRecommendShowed = true;
        this.c(context);
        StringBuilder builder = new StringBuilder(dataV2AppShareUrl);
        builder.append("?platform=").append(platformItem.mName);
        new ShareAppUponAuth("ShareAppUponAuth", Priority.LOW, builder.toString()).start();
    }

    public static Spipe inst() {
        if (instance == null) {
            throw new IllegalStateException("SpipeData not inited");
        }
        return instance;
    }

    public static String a(String platform) {
        StringBuilder builder = new StringBuilder(loginV2Url);
        builder.append("?platform=").append(Uri.encode(platform));
        AppLog.a(builder);
        return builder.toString();
    }

    public final int a(boolean arg5, String arg6) {
        int v1 = 0;
        if ((arg5) && !android.support.design.a.isTextEmpty(arg6)) {
            int v2 = -1;
            int v0 = 0;
            while (true) {
                if (v0 >= this.mSharePlatforms.length) {
                    v0 = v2;
                    break;
                } else if (!this.mSharePlatforms[v0].mName.equals(arg6)) {
                    ++v0;
                    continue;
                }

                break;
            }
            if (v0 < 0) {
                return v1;
            }

            v1 = v0 & 15 | 128;
        }

        return v1;
    }

    public final void addOnAccountRefreshListener(OnAccountRefreshListener onAccountRefreshListener) {
        this.onAccountRefreshListenerWeakList.add(onAccountRefreshListener);
    }

    public final void a(Context arg3, int arg4, int arg5) {
        this.C = System.currentTimeMillis();
        new k(arg3, this.P, arg4, arg5).start();
    }

    public final void a(boolean arg7) {
        long v4 = 0;
        if (this.isLogin) {
            this.isLogin = false;
            this.userId = v4;
            AppLog.a(this.userId);
            AppLog.d(this.sessionKey);
            this.userName = "";
            this.userGender = 0;
            this.screenName = "";
            this.userDescription = "";
            this.userLocation = "";
            this.userBirthday = "";
            this.userScore = 0;
            this.userVerified = false;
            this.isRecommendAllowed = false;
            ++this.z;
            this.A = this.z;
            this.B = this.z;
            this.mediaId = v4;
            this.verifyStatus = false;
            SharePlatform[] v2 = this.mSharePlatforms;
            int v3 = v2.length;
            int v0;
            for (v0 = 0; v0 < v3; ++v0) {
                v2[v0].mLogin = false;
            }

            this.c(this.O);
        }

        if (arg7) {
            this.P.sendEmptyMessage(1000);
        }
    }

    public final void a(Context arg10, String arg11, String arg12, String arg13, String arg14) {
        new k(arg10, this.P, this.z, arg11, arg12, arg13, arg14, this.a(true, arg11)).start();
    }

    static SharePlatform a(Spipe arg1) {
        return arg1.W;
    }

    public static String a(int arg1) {
        return arg1 <= 0 || arg1 >= 21 ? null : T[arg1];
    }

    public static void loginDupAlert(final Activity activity) {
        if (activity != null) {
            AlertDialog.Builder builder = com.ss.android.account.bb.a().a(((Context) activity));
            builder.setTitle(com.ss.android.article.browser.R.string.tip);
            if (!android.support.design.a.isTextEmpty(inst().Z)) {
                builder.setMessage(inst().Z);
            } else {
                builder.setMessage(com.ss.android.article.browser.R.string.ss_states_fail_bind_account);
            }

            builder.setPositiveButton(activity.getString(com.ss.android.article.browser.R.string.label_got), new DialogInterface.OnClickListener() {

                public final void onClick(DialogInterface dialogInterface, int which) {
                    MobClickCombiner.onEvent(activity, "xiangping", "login_dup_alert_close");
                }
            });
            builder.setNegativeButton(activity.getString(com.ss.android.article.browser.R.string.label_need_help), new DialogInterface.OnClickListener() {
                private final boolean b = true;

                public final void onClick(DialogInterface dialogInterface, int which) {
                    Intent intent = com.ss.android.account.bb.a().a(activity, this.b);
                    if (intent != null) {
                        activity.startActivity(intent);
                        MobClickCombiner.onEvent(activity, "xiangping", "login_dup_alert_help");
                    }
                }
            });
            builder.show();
            MobClickCombiner.onEvent(activity, "xiangping", "login_dup_alert");
        }
    }

    public static void a(Activity activity, Bundle bundle) {
        com.ss.android.account.v2.bb bbVar = ComponentsManifest.findComponent(com.ss.android.account.v2.bb.class);
        if (bundle == null) {
            bundle = new Bundle();
        }
        bundle.putBoolean("use_swipe", true);
        bbVar.startAccountLoginActivity(activity, bundle);
    }

    public static void a(Context arg3) {
        if (instance == null) {
            instance = new Spipe(arg3);
        }

        if (Logger.debug()) {
            Logger.d("Process", " SpipeData = " + instance.toString() + " pid = " + String.valueOf(Process.myPid()));
        }
    }

    private void a(boolean arg3, int arg4) {
        com.ss.android.account.bb.a().a(arg3, arg4);
        Object v0 = com.bytedance.frameworks.b.a.a.b(com.ss.android.bb.class);
        if (v0 != null) {
            ((com.ss.android.bb) v0).d();
        }

        Iterator v1 = this.onAccountRefreshListenerWeakList.iterator();
        while (v1.hasNext()) {
            v0 = v1.next();
            if (v0 == null) {
                continue;
            }

            ((OnAccountRefreshListener) v0).onAccountRefresh(arg3, arg4);
        }
    }

    public final void a(Message arg14) {
        int v0_1;
        long v8 = 0;
        int v3 = 0;
        boolean v2 = true;
        System.currentTimeMillis();
        int v1 = com.ss.android.article.browser.R.string.ss_states_fail_unknown;
        if ((arg14.obj instanceof com.ss.android.account.b.k.k$a)) {
            Object v0 = arg14.obj;
            long v4 = ((com.ss.android.account.b.k.k$a) v0).e;
            if (v4 > v8) {
                boolean v6 = this.isLogin;
                if (!this.isLogin) {
                    this.isLogin = true;
                    try {
                        CookieSyncManager.getInstance().sync();
                        v1 = 1;
                    } catch (Throwable v1_1) {
                        v1 = 1;
                    }
                } else {
                    v1 = 0;
                }
                label_51:
                if (this.userId != v4) {
                    this.userId = v4;
                    AppLog.a(this.userId);
                    v1 = 1;
                }

                if (!android.support.design.a.isTextEquals(this.userName, ((com.ss.android.account.b.k.k$a) v0).a)) {
                    this.userName = ((com.ss.android.account.b.k.k$a) v0).a;
                    v1 = 1;
                }

                if (!android.support.design.a.isTextEquals(this.screenName, ((com.ss.android.account.b.k.k$a) v0).c)) {
                    this.screenName = ((com.ss.android.account.b.k.k$a) v0).c;
                    v1 = 1;
                }

                if (this.userGender != ((com.ss.android.account.b.k.k$a) v0).b) {
                    this.userGender = ((com.ss.android.account.b.k.k$a) v0).b;
                    v1 = 1;
                }

                if (!android.support.design.a.isTextEquals(this.userDescription, ((com.ss.android.account.b.k.k$a) v0).d)) {
                    this.userDescription = ((com.ss.android.account.b.k.k$a) v0).d;
                    v1 = 1;
                }

                if (!android.support.design.a.isTextEquals(this.avatarUrl, ((com.ss.android.account.b.k.k$a) v0).f)) {
                    this.avatarUrl = ((com.ss.android.account.b.k.k$a) v0).f;
                    v1 = 1;
                }

                if (this.userVerified != ((com.ss.android.account.b.k.k$a) v0).g) {
                    this.userVerified = ((com.ss.android.account.b.k.k$a) v0).g;
                    v1 = 1;
                }

                if (!android.support.design.a.isTextEquals(this.pgcAvatarUrl, ((com.ss.android.account.b.k.k$a) v0).j)) {
                    this.pgcAvatarUrl = ((com.ss.android.account.b.k.k$a) v0).j;
                    v1 = 1;
                }

                if (!android.support.design.a.isTextEquals(this.pgcName, ((com.ss.android.account.b.k.k$a) v0).k)) {
                    this.pgcName = ((com.ss.android.account.b.k.k$a) v0).k;
                    v1 = 1;
                }

                if (this.pgcMediaid != ((com.ss.android.account.b.k.k$a) v0).i) {
                    this.pgcMediaid = ((com.ss.android.account.b.k.k$a) v0).i;
                    v1 = 1;
                }

                if (this.isRecommendAllowed != ((com.ss.android.account.b.k.k$a) v0).m) {
                    this.isRecommendAllowed = ((com.ss.android.account.b.k.k$a) v0).m;
                    v1 = 1;
                }

                if (!android.support.design.a.isTextEquals(this.recommendHintMessage, ((com.ss.android.account.b.k.k$a) v0).n)) {
                    this.recommendHintMessage = ((com.ss.android.account.b.k.k$a) v0).n;
                    v1 = 1;
                }

                if (!android.support.design.a.isTextEquals(this.sessionKey, ((com.ss.android.account.b.k.k$a) v0).o)) {
                    this.sessionKey = ((com.ss.android.account.b.k.k$a) v0).o;
                    AppLog.d(this.sessionKey);
                    v1 = 1;
                }

                if (this.mediaId != ((com.ss.android.account.b.k.k$a) v0).p) {
                    this.mediaId = ((com.ss.android.account.b.k.k$a) v0).p;
                    v1 = 1;
                }

                SharePlatform[] v7 = this.M;
                int v5 = 0;
                while (v5 < 3) {
                    SharePlatform v8_1 = v7[v5];
                    v8_1.mLogin = false;
                    if (!v6) {
                        if ((v8_1.mSelected) || (v8_1.mPublishSelected)) {
                            v1 = 1;
                        }

                        v8_1.mSelected = false;
                        v8_1.mPublishSelected = false;
                    }

                    int v4_1 = v1;
                    Object v1_2 = ((com.ss.android.account.b.k.k$a) v0).h.get(v8_1.mName);
                    if (v1_2 != null) {
                        v8_1.mLogin = true;
                        v8_1.mExpire = ((SharePlatform) v1_2).mExpire;
                        v8_1.mExpireIn = ((SharePlatform) v1_2).mExpireIn;
                        v8_1.mNickname = ((SharePlatform) v1_2).mNickname;
                        v8_1.mAvatar = ((SharePlatform) v1_2).mAvatar;
                        v8_1.mPlatformUid = ((SharePlatform) v1_2).mPlatformUid;
                        if (!v6) {
                            if (!v8_1.mSelected || !v8_1.mPublishSelected) {
                                v4_1 = 1;
                            }

                            if ("qzone_sns".equals(v8_1.mName)) {
                            } else {
                                v8_1.mSelected = true;
                                v8_1.mPublishSelected = true;
                            }
                        }
                        v8_1.mNotTipExpiredTime = -1;
                    }

                    ++v5;
                    v1 = v4_1;
                }

                v0_1 = arg14.arg1;
                this.isLogin = true;
                v3 = v1;
            } else if (this.isLogin) {
                this.isLogin = false;
                this.userId = v8;
                this.userName = "";
                this.userGender = 0;
                this.screenName = "";
                this.avatarUrl = "";
                this.userDescription = "";
                this.userBirthday = "";
                this.userLocation = "";
                this.userScore = 0;
                this.userVerified = false;
                this.isRecommendAllowed = false;
                this.sessionKey = "";
                this.mediaId = v8;
                this.verifyStatus = false;
                v0_1 = v1;
                v2 = false;
                v3 = 1;
            } else {
                v0_1 = v1;
                v2 = false;
            }
        } else {
            v0_1 = v1;
            v2 = false;
        }

        if (v3 != 0) {
            this.c(this.O);
        }

        this.a(v2, v0_1);
    }

    public final void a(String arg17, Context arg18) {
        if (!android.support.design.a.isTextEmpty(arg17) && arg18 != null) {
            String[] v6 = arg17.split(",");
            if (v6 == null) {
                return;
            }

            SharePlatform[] v7 = this.mSharePlatforms;
            int v8 = v7.length;
            int v5;
            for (v5 = 0; v5 < v8; ++v5) {
                SharePlatform v9 = v7[v5];
                int v10 = v6.length;
                int v4 = 0;
                int v2 = 0;
                while (v4 < v10) {
                    if (v9.mName.equals(v6[v4])) {
                        if ("sina_weibo".equals(v9.mName)) {
                            int v3 = System.currentTimeMillis() - this.lastShowWeiboExpiredTime > (((long) (cc.a().a * 24 * 60 * 60 * 1000))) ? 1 : 0;
                            if (v3 != 0) {
                                this.lastShowWeiboExpiredTime = System.currentTimeMillis();
                            }

                            if (v3 == 0) {
                            } else {
                                v2 = 1;
                                this.W = v9;
                            }
                        } else {
                            if (v9.mNotTipExpiredTime != -1 && System.currentTimeMillis() - v9.mNotTipExpiredTime <= 1296000000) {
                            } else {
                                v2 = 1;
                                this.W = v9;
                            }
                        }
                        if (v2 != 0) {
                            break;
                        }
                    }

                    ++v4;
                }

                if (v2 != 0 && this.O != null) {
                    String v2_1 = this.O.getString(v9.mVerbose);
                    AlertDialog.Builder v3_1 = com.ss.android.account.bb.a().a(arg18);
                    v3_1.setPositiveButton(com.ss.android.article.browser.R.string.k0, new com.ss.android.account.k(this, arg18));
                    v3_1.setNegativeButton(com.ss.android.article.browser.R.string.jy, new l(this));
                    v3_1.setMessage(String.format(arg18.getString(com.ss.android.article.browser.R.string.jz), v2_1));
                    try {
                        v3_1.show();
                    } catch (Exception v2_2) {
                    }

                    return;
                }
            }
        }
    }

    public static String b(String arg3) {
        StringBuilder v0 = new StringBuilder(loginContinueUrl);
        v0.append("?platform=").append(Uri.encode(arg3));
        v0.append("&auth_token=").append(Uri.encode(null));
        v0.append("&unbind_exist=1");
        AppLog.a(v0);
        return v0.toString();
    }

    public final void b(OnAccountRefreshListener arg2) {
        this.onAccountRefreshListenerWeakList.remove(arg2);
    }

    static SharePlatform b(Spipe arg1) {
        arg1.W = null;
        return null;
    }

    public final List b() {
        ArrayList v0 = new ArrayList();
        if (this.isLogin) {
            SharePlatform[] v2 = this.mSharePlatforms;
            int v3 = v2.length;
            int v1;
            for (v1 = 0; v1 < v3; ++v1) {
                SharePlatform v4 = v2[v1];
                if (v4.mLogin) {
                    ((List) v0).add(v4);
                }
            }
        }

        return ((List) v0);
    }

    public final void b(Context arg3) {
        this.a(arg3, this.A, 0);
    }

    public static int c(String arg3) {
        int v0;
        if (arg3 == null) {
            v0 = 0;
        } else {
            Object v0_1 = U.get(arg3);
            if (v0_1 == null) {
                v0 = 0;
            } else {
                v0 = ((Integer) v0_1).intValue();
                if (v0 > 0 && v0 < 21) {
                    return v0;
                }

                v0 = 0;
            }
        }

        return v0;
    }

    public final void c(Context context) {
        SharePlatform v8;
        StringBuilder v4 = new StringBuilder();
        SharePlatform[] v5 = this.mSharePlatforms;
        int v6 = v5.length;
        int v3 = 0;
        int v0 = 1;
        while (v3 < v6) {
            SharePlatform v7 = v5[v3];
            if ((v7.mLogin) && (v7.mSelected)) {
                if (v0 == 0) {
                    v4.append(",");
                }

                v4.append(v7.mName);
                v0 = 0;
            }

            ++v3;
        }

        String platforms = v4.toString();
        StringBuilder v5_1 = new StringBuilder();
        SharePlatform[] v6_1 = this.mSharePlatforms;
        int v7_1 = v6_1.length;
        v3 = 0;
        v0 = 1;
        while (v3 < v7_1) {
            v8 = v6_1[v3];
            if ((v8.mLogin) && (v8.mPublishSelected)) {
                if (v0 == 0) {
                    v5_1.append(",");
                }

                v5_1.append(v8.mName);
                v0 = 0;
            }

            ++v3;
        }

        String publishSelectedPlatforms = v5_1.toString();
        v5_1 = new StringBuilder();
        v6_1 = this.mSharePlatforms;
        v7_1 = v6_1.length;
        v0 = 1;
        int v2;
        for (v2 = 0; v2 < v7_1; ++v2) {
            v8 = v6_1[v2];
            if (v8.mRecommendShowed) {
                if (v0 == 0) {
                    v5_1.append(",");
                }

                v5_1.append(v8.mName);
                v0 = 0;
            }
        }

        String showedPlatforms = v5_1.toString();
        JSONObject expirePlatforms = new JSONObject();
        SharePlatform[] v7_2 = this.mSharePlatforms;
        int v8_1 = v7_2.length;
        for (v2 = 0; v2 < v8_1; ++v2) {
            SharePlatform v0_1 = v7_2[v2];
            if (v0_1.mNotTipExpiredTime > 0) {
                try {
                    expirePlatforms.put(v0_1.mName, v0_1.mNotTipExpiredTime);
                } catch (JSONException v0_2) {
                    v0_2.printStackTrace();
                }
            }
        }

        SharedPreferences.Editor editor = context.getSharedPreferences("com.ss.spipe_setting", 0).edit();
        editor.putString("platforms", platforms);
        editor.putString("publish_selected_platforms", publishSelectedPlatforms);
        editor.putString("expire_platforms", expirePlatforms.toString());
        editor.putString("showed_platforms", showedPlatforms);
        editor.remove("session");
        editor.putBoolean("is_login", this.isLogin);
        editor.putLong("user_id", this.userId);
        editor.putString("session_key", this.sessionKey);
        editor.putString("user_name", this.userName);
        editor.putInt("user_gender", this.userGender);
        editor.putString("screen_name", this.screenName);
        editor.putBoolean("user_verified", this.userVerified);
        editor.putString("avatar_url", this.avatarUrl);
        editor.putString("user_description", this.userDescription);
        editor.putString("user_location", this.userLocation);
        editor.putString("user_birthday", this.userBirthday);
        editor.putInt("user_score", this.userScore);
        editor.putLong("pgc_mediaid", this.pgcMediaid);
        editor.putString("pgc_avatar_url", this.pgcAvatarUrl);
        editor.putString("pgc_name", this.pgcName);
        editor.putBoolean("is_recommend_allowed", this.isRecommendAllowed);
        editor.putString("recommend_hint_message", this.recommendHintMessage);
        editor.putLong("last_show_weibo_expired_time", this.lastShowWeiboExpiredTime);
        editor.putLong("media_id", this.mediaId);
        editor.putBoolean("verify_status", this.verifyStatus);
        SharedPreferenceCompat.commit(editor);
    }

    public final SharePlatform[] c() {
        return !this.isLogin ? new SharePlatform[0] : this.ab;
    }

    public final boolean d(String arg6) {
        boolean v0 = false;
        if ((this.isLogin) && !android.support.design.a.isTextEmpty(arg6)) {
            SharePlatform[] v2 = this.M;
            int v1;
            for (v1 = 0; v1 < 3; ++v1) {
                SharePlatform v3 = v2[v1];
                if ((v3.mLogin) && (v3.mName.equals(arg6))) {
                    return true;
                }
            }
        }

        return v0;
    }

    public static Intent d() {
        return null;
    }

    private static String withIbHost(String path) {
        return "http://ib.snssdk.com" + path;
    }

    public final void e() {
        System.currentTimeMillis();
        new i(this, "LogoutThread", Priority.HIGH).start();
    }

    private static String withIsubHost(String arg2) {
        return "http://isub.snssdk.com" + arg2;
    }

    public final void f() {
        this.a(true);
    }

    public final void g() {
        Iterator v0 = this.ad.iterator();
        while (v0.hasNext()) {
            v0.next();
        }
    }

    public final boolean h() {
        boolean v0 = false;
        if (this.isLogin) {
            SharePlatform[] v2 = this.mSharePlatforms;
            int v3 = v2.length;
            int v1 = 0;
            while (v1 < v3) {
                if (v2[v1].mLogin) {
                    v0 = true;
                } else {
                    ++v1;
                    continue;
                }

                return v0;
            }
        }

        return v0;
    }

    public final void handleMsg(Message message) {
        int v0 = com.ss.android.article.browser.R.string.ss_states_fail_unknown;
        int v2 = -1;
        switch (message.what) {
            case 1000: {
                if (message.arg1 > 0) {
                    this.a(false, message.arg1);
                    return;
                }

                this.a(true, 0);
                break;
            }
            case 1001: {
                this.B = this.z;
                this.A = v2;
                this.a(message);
                break;
            }
            case 1002: {
                this.A = v2;
                int v1 = message.arg1;
                Bundle v2_1 = message.getData();
                switch (v1) {
                    case 12: {
                        v0 = com.ss.android.article.browser.R.string.ss_states_fail_no_connection;
                        this.a(false, v0);
                        return;
                    }
                    case 14: {
                        v0 = com.ss.android.article.browser.R.string.ss_states_fail_network_timeout;
                        this.a(false, v0);
                        return;
                    }
                    case 15: {
                        v0 = com.ss.android.article.browser.R.string.ss_states_fail_network_error;
                        this.a(false, v0);
                        return;
                    }
                    case 105: {
                        this.B = this.z;
                        v0 = com.ss.android.article.browser.R.string.ss_states_fail_session_expire;
                        this.a(false);
                        this.a(false, v0);
                        return;
                    }
                    case 111: {
                        if (v2_1 != null) {
                            this.Z = v2_1.getString("bundle_error_tip");
                        }
                        SubscriptionRouter.c(new com.ss.android.account.bus.event.b());
                        return;
                    }
                    default: {
                        label_16:
                        this.a(false, v0);
                        return;
                    }
                }
            }
            case 1007: {
                if ((message.obj instanceof String)) {
                    Object v0_1 = message.obj;
                    this.userName = ((String) v0_1);
                    this.screenName = ((String) v0_1);
                }

                this.g();
                break;
            }
            case 1008: {
                this.g();
                return;
            }
            case 1017: {
                this.a(true);
                SubscriptionRouter.c(new g());
                break;
            }
            case 1018: {
            }
        }
    }
}

